#include <iostream>
#include <algorithm>
#include <string>
#include <unordered_map>
#include <queue>
#include <vector>
using namespace std;
const int N = 15;
char board[N];
unordered_map<string, int> hsh;
queue<string> q;
string op;
string ans = "12345678x";
string origin;
int dx[4] = { 0, 0, 1, -1 };
int dy[4] = { 1, -1, 0, 0 };
string ops = "lrud";


void get_pos(int& i, int& j, const int pos)
{
    i = pos / 3, j = pos % 3;
}

int pos_to_i(int x, int y) { return x * 3 + y; }

void bfs()
{
    while(!q.empty())
    {
        const auto str = q.front();
        const int time = hsh[str];
        q.pop();
        // 找到x的位置
        int pos = -1;
        for(int i = 0; i < 9; ++i)
            if(str[i] == 'x')
            {
                pos = i;
                break;
            }
        int x, y;
        get_pos(x, y, pos);
        for(int i = 0; i < 4; ++i)
        {
            int xx = x + dx[i], yy = y + dy[i];
            if(xx >= 0 && xx < 3 && yy >= 0 && yy < 3)
            {
                string tmp = str;
                int next = pos_to_i(xx, yy);
                swap(tmp[pos], tmp[next]);
                if(!hsh.count(tmp)) // 如果tmp没有出现过，那就要加入队列
                {
                    q.push(tmp), hsh[tmp] = time + 1;
                    if(tmp == ans) return;
                }
            }
        }
    }
}

void get_op()
{
    int time = hsh[ans];
    string now = ans;
    while(time)
    {
        const string str = now;
        // 找到x的位置
        int t = -1;
        for(int i = 0; i < 9; ++i)
            if(now[i] == 'x')
            {
                t = i;
                break;
            }
        int x, y;
        get_pos(x, y, t);
        for(int i = 0; i < 4; ++i)
        {
            string tmp = str;
            int xx = x + dx[i], yy = y + dy[i];
            int next = pos_to_i(xx, yy);
            if(xx >= 0 && xx < 3 && yy >= 0 && yy < 3)
            {
                swap(tmp[next], tmp[t]);
                if(hsh[tmp] == time - 1)
                {
                    op.push_back(ops[i]);
                    now = tmp;
                    time--;
                    break;
                }
            }
        }
    }
}

int main()
{
    for(int i = 0; i < 9; ++i)
        cin >> board[i];
    origin = board;
    q.push(board);
    hsh[board] = 0;
    bfs();
    if(hsh.count(ans) == 0)
    {
        cout << "unsolvable" << endl;
        return 0;
    }
    // cout << hsh[ans] << endl;
    get_op();
    reverse(op.begin(), op.end());
    cout << op << endl;
    return 0;
}
